﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Sinacor.Infra.ServiceAccess;
using Sample.AspNet.Bmf.Calendario.Calendario;
using System.Collections.Generic;
using Sample.AspNet.Bmf.Ordens.Ordem;

namespace Sample.AspNet
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            GridView1.DataSource = null;
            List<DateTime> datas;

            AuthenticationParm parm = new AuthenticationParm();
            parm.LoginName = "BMF03";
            parm.Password = "BMF03XX";
            parm.CompanyId = 21;

            using (ServiceClient<ICalendario> sc = new ServiceClient<ICalendario>(parm,
                "Tcp.Bmf.Calendario.Calendario.ICalendario",
                @"C:\Sinacor\Mais\Projetos\MAIN\Source\Infra_2.0_desenv\SDK\Sample.AspNet\Endpoints\Bmf.Calendario.config"))
            {

                ICalendario calendario = sc.CreateProxy();

                datas = calendario.ConsultarDatasPregoes();
            }
            GridView1.DataSource = datas;
            GridView1.DataBind();
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            GridView2.DataSource = null;
            List<ConsultarNetGeralClienteResponse> ordens = null;

            AuthenticationParm parm = new AuthenticationParm();
            parm.LoginName = "BMF03";
            parm.Password = "BMF03XX";
            parm.CompanyId = 21;

            using (ServiceClient<IOrdem> sc = new ServiceClient<IOrdem>(parm,
                "Tcp.Bmf.Ordens.Ordem.IOrdem",
                @"C:\Sinacor\Mais\Projetos\MAIN\Source\Infra_2.0_desenv\SDK\Sample.AspNet\Endpoints\Bmf.Ordens.config"))
            {
                IOrdem ordem = sc.CreateProxy();

                ConsultarNetGeralClienteRequest request = new ConsultarNetGeralClienteRequest();

                ordens = ordem.ConsultarOrdensNetGeralCliente(request);
            }
            GridView2.DataSource = ordens;
            GridView2.DataBind();
        }
    }
}
